home *** CD-ROM | disk | FTP | other *** search
/ PC-X 1997 October / pcx14_9710.iso / swag / delphi.swg / 0214_Calling Internet Explorer.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1997-03-04  |  593 b   |  36 lines

  1. program iexplor;
  2. uses
  3.    Windows, OLEAuto;
  4.  
  5.  
  6. procedure OpenInternetExplorer( sURL : string );
  7. const
  8. csOLEObjName = 'InternetExplorer.Application';
  9. var
  10. IE        : Variant;
  11. WinHanlde : HWnd;
  12. begin
  13. if( VarIsEmpty( IE ) )then
  14. begin
  15. IE := CreateOleObject( csOLEObjName );
  16. IE.Visible := true;
  17. IE.Navigate( sURL );
  18. end else
  19. begin
  20. WinHanlde := FindWIndow( 'IEFrame', nil );
  21. if( 0 <> WinHanlde )then
  22. begin
  23. IE.Navigate( sURL );
  24. SetForegroundWindow( WinHanlde );
  25. end else
  26. begin
  27. // handle error ...
  28. end;
  29. end;
  30. end;
  31.  
  32. begin
  33. OpenInternetExplorer( 'microsoft.com' );
  34. end.
  35.  
  36.